package com.sinosoft.cloud.controller;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.sinosoft.cloud.bl.CalFactorBL;
import com.sinosoft.cloud.bl.GetTbResultBL;
import com.sinosoft.cloud.rest.TradeInfo;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
@RestController
public class CalFactorController {

    Log log = LogFactory.getLog(this.getClass());

    @Autowired
    CalFactorBL calFactorBL;

    @Autowired
    GetTbResultBL getTbResultBL;

    @RequestMapping(value = "/cal/fee", method = RequestMethod.POST)
    @ResponseBody
    public TradeInfo add(@RequestBody TradeInfo tradeInfo) {
        log.info("保费计算，接到前端请求数据:::::" + tradeInfo.toJson());
        tradeInfo = calFactorBL.submitData(tradeInfo);
        log.info("保费计算，返回数据:::::" + tradeInfo.toJson());
        return tradeInfo;
    }
    @RequestMapping(value = "/cal/get_tb_result", method = RequestMethod.POST)
    @ResponseBody
    public TradeInfo testRes(@RequestBody TradeInfo tradeInfo){
        tradeInfo = getTbResultBL.submitData(tradeInfo);
        return tradeInfo;
    }
}
